package com.example.http;



/**
 * @author jingbin
 * @data 2018/2/9
 * @Description
 */

public class BuildFactory {

    private static BuildFactory instance;
    private Object https;


    public static BuildFactory getInstance() {
        if (instance == null) {
            synchronized (BuildFactory.class) {
                if (instance == null) {
                    instance = new BuildFactory();
                }
            }
        }
        return instance;
    }

    public <T> T create(Class<T> a) {
//        if (https == null) {
//            synchronized (BuildFactory.class) {
//                if (https == null) {
//                    https = HttpClient.getInstance().getBuilder(HttpClient.BASE_URL).build().create(a);
//                }
//            }
//        }

        return HttpClient.getInstance().getBuilder(HttpClient.BASE_URL).build().create(a);


    }
    public static <T> T getService(Class <T> a ) {
        return BuildFactory.getInstance().create(a);
    }
    public static <T> T getBaiduService(Class <T> a ) {
        return HttpClient.getInstance().getBuilder(HttpClient.BAIDU_OAUTH_URL).build().create(a);
    }

}
